﻿using UnityEngine;

public class EventMouseButtonLeftEditor {
	// === Public =====================================================================================================
	public static void Action() {
		if (!Input.GetMouseButton(InputConstants.MOUSE_BUTTON_LEFT)) {
			return;
		}
		var viewPort = MapEditorBaseData.GetInstance.Camera.camera.ScreenToViewportPoint(Input.mousePosition);
		if (viewPort.x < 0 || viewPort.y < 0) {
			return;
		}

		switch (MapEditorBaseData.GetInstance.ModelType) {
			case ElementType.Eraser:
				if(Input.GetMouseButtonDown(InputConstants.MOUSE_BUTTON_LEFT)) {
					ActionEraser.FixHeight();
				}
				ActionEraser.DeleteObjectUsingEraser();
				break;
			case ElementType.Tile:
				ActionTile.CreateOrChangeObjectUsingTile();
				break;
			case ElementType.Wall:
				ActionWall.CreateOrChangeObjectUsingWall();
				break;
			case ElementType.Stone:
				break;
		}
	}
}